package com.epfresh.bean;

import com.epfresh.global.CartHelper;
import com.epfresh.utils.FormatUtil;

import java.util.ArrayList;

public class ListGoodsOld implements CartHelper.CartHelperTools{

    /*
  }, {
    "tags" : [ {
      "color" : "#ff0000",
      "name" : "热销"
    }, {
      "color" : "#ff0000",
      "name" : "绿色"
    } ],
    "id" : 31,
    "title" : "高塬苹果 来自铜川耀州区",
    "level" : "一级",
    "price" : "80.0元/箱",
    "thumbnail" : "http://7xp

    "package" : "15公斤/箱",
    "origin" : "铜川市耀州区",
    "mark" : null,
    "type" : 1,
    "storeId" : 2
    * */


    String msg;
    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public ArrayList<String> getFastMessages() {
        return fastMessages;
    }

    public void setFastMessages(ArrayList<String> fastMessages) {
        this.fastMessages = fastMessages;
    }

    private ArrayList<String> fastMessages;
    private String deliveryTime;
    private String pluckingTime;
    private String id;
    private String cartId;
    private String title;
    private String level;
    private String thumbnail;
    private String price;
    private String preBuyPersonsCount;
    private String origin;
    private String pack;
    private String type;
    private String mark;
    private String shoppingCarId;
    private String storeId;
    private String storeName;
    private String marketingTime;
    private String marketName;
    private ArrayList<HomeCommTag> tags;
    private double leastCount;
    private double moq;
    private double unitPrice;
    private double inventory;

    private double depositRatio;
    private String notice;

    private boolean isSelect;
    private Boolean show;

    private String packageContainer;
    private String packageUnit;
    private String chargeUnit;

    private Double originalPrice;//原价，
    private double priceOnly;//现价，
    private Double discountRate;//折扣率

    private String promotionItemQuantityPerAccount;
    private String promotionItemEndTime;
    private String promotionItemId;
    private String promotionItemType;
    private String promotionItemStatus;
    private String promotionItemBeginTime;
    private String promotionMarkUrl;
    private boolean isOfferProduct;

    public boolean isOfferProduct() {
        return isOfferProduct;
    }

    public void setOfferProduct(boolean offerProduct) {
        this.isOfferProduct = offerProduct;
    }
/*@property (nonatomic, strong) NSString *promotionItemQuantityPerAccount;
    @property (nonatomic, strong) NSString *promotionItemEndTime;
    @property (nonatomic, strong) NSString *promotionItemId;
    @property (nonatomic, strong) NSString *promotionItemType;
    @property (nonatomic, strong) NSString *promotionItemStatus;
    @property (nonatomic, strong) NSString *promotionItemBeginTime;*/


    public Boolean isShow() {
        return show == null ? false : show;
    }

    public void setShow(Boolean show) {
        this.show = show;
    }

    public String getPromotionMarkUrl() {
        return promotionMarkUrl;
    }

    public void setPromotionMarkUrl(String promotionMarkUrl) {
        this.promotionMarkUrl = promotionMarkUrl;
    }

    public Double getOriginalPrice() {
        return originalPrice;
    }

    public void setOriginalPrice(Double originalPrice) {
        this.originalPrice = originalPrice;
    }

    public String getPromotionItemQuantityPerAccount() {
        return promotionItemQuantityPerAccount;
    }

    public void setPromotionItemQuantityPerAccount(String promotionItemQuantityPerAccount) {
        this.promotionItemQuantityPerAccount = promotionItemQuantityPerAccount;
    }

    public String getPromotionItemEndTime() {
        return promotionItemEndTime;
    }

    public void setPromotionItemEndTime(String promotionItemEndTime) {
        this.promotionItemEndTime = promotionItemEndTime;
    }

    public String getPromotionItemId() {
        return promotionItemId;
    }

    public void setPromotionItemId(String promotionItemId) {
        this.promotionItemId = promotionItemId;
    }

    public String getPromotionItemType() {
        return promotionItemType;
    }

    public void setPromotionItemType(String promotionItemType) {
        this.promotionItemType = promotionItemType;
    }

    public String getPromotionItemStatus() {
        return promotionItemStatus;
    }

    public void setPromotionItemStatus(String promotionItemStatus) {
        this.promotionItemStatus = promotionItemStatus;
    }

    public String getPromotionItemBeginTime() {
        return promotionItemBeginTime;
    }

    public void setPromotionItemBeginTime(String promotionItemBeginTime) {
        this.promotionItemBeginTime = promotionItemBeginTime;
    }

    public String getShoppingCarId() {
        return shoppingCarId;
    }

    public void setShoppingCarId(String shoppingCarId) {
        this.shoppingCarId = shoppingCarId;
    }

    public void setLeastCount(double leastCount) {
        this.leastCount = leastCount;
    }

    public Double getOriginalPric() {
        return originalPrice;
    }

    public void setOriginalPric(Double originalPric) {
        this.originalPrice = originalPric;
    }

    public Double getDiscountRate() {
        return discountRate;
    }

    public void setDiscountRate(Double discountRate) {
        this.discountRate = discountRate;
    }

    public String getCartId() {
        return cartId;
    }

    public void setCartId(String cartId) {
        this.cartId = cartId;
    }

    public double getInventory() {
        return inventory;
    }

    public void setInventory(double inventory) {
        this.inventory = inventory;
    }

    public double getPriceOnly() {
        return priceOnly;
    }

    public void setPriceOnly(double priceOnly) {
        this.priceOnly = priceOnly;
    }

    public String getPackageContainer() {
        return packageContainer;
    }

    public void setPackageContainer(String packageContainer) {
        this.packageContainer = packageContainer;
    }

    public String getMarketName() {
        return marketName;
    }

    public void setMarketName(String marketName) {
        this.marketName = marketName;
    }

    public String getPackageUnit() {
        return packageUnit;
    }

    public void setPackageUnit(String packageUnit) {
        this.packageUnit = packageUnit;
    }

    public String getChargeUnit() {
        return chargeUnit;
    }

    public void setChargeUnit(String chargeUnit) {
        this.chargeUnit = chargeUnit;
    }

    public String getPluckingTime() {
        return pluckingTime;
    }

    public void setPluckingTime(String pluckingTime) {
        this.pluckingTime = pluckingTime;
    }

    public String getDeliveryTime() {
        return deliveryTime;
    }

    public void setDeliveryTime(String deliveryTime) {
        this.deliveryTime = deliveryTime;
    }

    int isAcceptOrders;
    String modifiedTime;
    String modifiedTimeString;
    private String lastSnapshotId;
    private double count;

    double incr;/*添加购物车的倍数字段适应多倍和1倍*/

    public double getMoq() {
        return moq;
    }

    public void setMoq(double moq) {
        this.moq = moq;
    }

    public double getIncr() {
        return incr;
    }

    public void setIncr(double incr) {
        this.incr = incr;
    }

    public void addCartCount(double cnt) {
        if (count < 0) {
            count = 0;
        }
        count += cnt;
    }

    public double getCount() {
        return count;
    }

    public String getGoodsCount() {
        String s = FormatUtil.subZeroAndDot(count + "");
        if ("0".equals(s)) {
            return "";
        }
        return s;
    }

    @Override
    public String getUniqueKey() {
        return getIdPlus();
    }

    public void setCount(double count) {
        this.count = count;
    }

    public String getLastSnapshotId() {
        return lastSnapshotId;
    }

    public void setLastSnapshotId(String lastSnapshotId) {
        this.lastSnapshotId = lastSnapshotId;
    }

    public String getStoreName() {
        return storeName == null ? "" : storeName;
    }

    public void setStoreName(String storeName) {
        this.storeName = storeName;
    }

    public String getModifiedTimeString() {
        return modifiedTimeString;
    }

    public void setModifiedTimeString(String modifiedTimeString) {
        this.modifiedTimeString = modifiedTimeString;
    }

    public void setIsSelect(boolean isSelect) {
        this.isSelect = isSelect;
    }

    public int getIsAcceptOrders() {
        return isAcceptOrders;
    }

    public void setIsAcceptOrders(int isAcceptOrders) {
        this.isAcceptOrders = isAcceptOrders;
    }

    public String getModifiedTime() {
        return modifiedTime;
    }

    public void setModifiedTime(String modifiedTime) {
        this.modifiedTime = modifiedTime;
    }

    public ListGoodsOld() {
    }

    public ListGoodsOld(String notice, double unitPrice, int leastCount, String marketingTime, String preBuyPersonsCount, String id, String title, String level, String thumbnail, String price, String origin, String pack, String type, String mark, String storeId, ArrayList<HomeCommTag> tags) {
        this.id = id;
        this.notice = notice;
        this.unitPrice = unitPrice;
        this.leastCount = leastCount;
        this.marketingTime = marketingTime;
        this.preBuyPersonsCount = preBuyPersonsCount;
        this.title = title;
        this.level = level;
        this.thumbnail = thumbnail;
        this.price = price;
        this.origin = origin;
        this.pack = pack;
        this.type = type;
        this.mark = mark;
        this.storeId = storeId;
        this.tags = tags;
    }

    public double getDepositRatio() {
        return depositRatio;
    }

    public void setDepositRatio(double depositRatio) {
        this.depositRatio = depositRatio;
    }

    public String getNotice() {
        return notice;
    }

    public void setNotice(String notice) {
        this.notice = notice;
    }

    public double getUnitPrice() {
        return unitPrice;
    }

    public void setUnitPrice(double unitPrice) {
        this.unitPrice = unitPrice;
    }

    public double getLeastCount() {
        return leastCount;
    }

    public void setLeastCount(int leastCount) {
        this.leastCount = leastCount;
    }

    public String getMarketingTime() {
        return marketingTime;
    }

    public void setMarketingTime(String marketingTime) {
        this.marketingTime = marketingTime;
    }

    public String getPreBuyPersonsCount() {
        return preBuyPersonsCount;
    }

    public void setPreBuyPersonsCount(String preBuyPersonsCount) {
        this.preBuyPersonsCount = preBuyPersonsCount;
    }

    public String getId() {
        return id;
    }
    public String getIdPlus() {
        if (promotionItemId != null ){
            return id+"|"+promotionItemId;
        }
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getLevel() {
        return level;
    }

    public void setLevel(String level) {
        this.level = level;
    }

    public String getThumbnail() {
        return thumbnail;
    }

    public void setThumbnail(String thumbnail) {
        this.thumbnail = thumbnail;
    }

    public String getPrice() {
        return price;
    }
    public String getPriceUnit() {
        return "元/"+chargeUnit;
    }

    public String getPriceFloat() {
        String s = null;
        if (price != null && price.contains("元")) {
            int index = price.indexOf("元");
            s = price.substring(0, index);
        }

        return s;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public String getOrigin() {
        return origin;
    }

    public void setOrigin(String origin) {
        this.origin = origin;
    }

    public String getPack() {
        return pack;
    }

    public void setPack(String pack) {
        this.pack = pack;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getMark() {
        return mark;
    }

    public void setMark(String mark) {
        this.mark = mark;
    }

    public String getStoreId() {
        return storeId;
    }

    public void setStoreId(String storeId) {
        this.storeId = storeId;
    }

    public ArrayList<HomeCommTag> getTags() {
        return tags;
    }

    public void setTags(ArrayList<HomeCommTag> tags) {
        this.tags = tags;
    }

    public boolean isSelect() {
        return isSelect;
    }

    public void setSelect(boolean select) {
        isSelect = select;
    }

    public long getProductIdLong() {
        long l = 0;
        if (id != null && !"".equals(id)) {
            l = Long.valueOf(id);
        }
        return l;
    }

    public boolean isAcceptOrders() {
        //1是接单
        return isAcceptOrders != 1 ? false : true;
    }

    public String getMarketStoreName(){
        String market = "" ;
        if (marketName != null && marketName.length() > 0){
            market = marketName + "  ";
        }

        if (storeName == null){
            return market;
        }
        return market + storeName;
    }
}
